package com.example.testtransition

import android.content.Context
import android.util.AttributeSet
import android.view.View
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.bottomsheet.BottomSheetBehavior
//import com.yidui.business.moment.publish.logger

open class CustomBottomSheetBehavior<T: View> : BottomSheetBehavior<T> {
    val TAG = CustomBottomSheetBehavior::class.java.simpleName

    constructor() : super()

    constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)


    override fun onStartNestedScroll(coordinatorLayout: CoordinatorLayout, child: T, directTargetChild: View, target: View, axes: Int, type: Int): Boolean {
//        logger.i(TAG, "onStartNestedScroll: ")
        if (target is RecyclerView && state == STATE_COLLAPSED) {
            return false
        }
        return super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, axes, type)
    }

    override fun layoutDependsOn(parent: CoordinatorLayout, child: T, dependency: View): Boolean {
        return super.layoutDependsOn(parent, child, dependency)
    }
}